import 'package:flutter/material.dart';
import 'package:ytbusiness/config/url.dart';
import 'package:ytbusiness/models/notify_list_model.dart';
import 'package:ytbusiness/repository/http.dart';

///
class PublicRequest {
  /// 获取通知消息
  Future<NotifyListModel> getNotify({
    BuildContext context,
    Map<String, dynamic> data,
  }) async {
    Map<String, dynamic> map = await Http()
        .get(Url.notify, context: context, data: data) as Map<String, dynamic>;
    if (map != null && map.isNotEmpty) {
      if (map["code"] == 1001) {
        return NotifyListModel.fromJson(map);
      }
    }
    return Future.error("接口请求失败");
  }
}
